package com.ztf.config;

import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class RestTemplateConfig {
    // 向Spring IoC容器中注入RestTemplate
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    // 向Spring IoC容器中注入RestTemplate
    @Bean
    @LoadBalanced  // 让该RestTemplate具备Ribbon的能力
    public RestTemplate ribbonRestTemplate(){
        return new RestTemplate();
    }


}
